<template>
	<view>
		<view style="display: flex;margin:30rpx 0 20rpx 30rpx;">请输入通知消息</view>
		<textarea style="
		  margin: 0 auto;
		    padding: 20rpx 25rpx;
		    border-radius: 12rpx;
		    box-shadow: 1px 1px 8px rgba(194,194,194,0.3);
		    width: 680rpx;
		    min-height: 200rpx;
		    font-size: 28rpx;
		    line-height: 1.6;
		    border: 1rpx solid #eaeaea;
		    background-color: #f9f9f9;
		    transition: all 0.3s ease;
		  " v-model="notice" focus placeholder="请输入通知消息内容" maxlength="-1"></textarea>
		<view style="display: flex;flex-direction: row;margin-top: 80rpx;justify-content: center;">
			<view
				style="display: flex;width: 120rpx;border-radius: 15rpx;background-color: blue;color: white;justify-content: center;align-items: center;padding: 10rpx;"
				@click="update_notice">
				修改
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				notice: ""
			}
		},
		onLoad() {
			this.get_notice()
		},
		methods: {
			update_notice() {
				uni.showLoading({
					mask: true,
					title: "加载中……"
				})
				uniCloud.callFunction({
					name: "delpic",
					data: {
						leixing: 18,
						tiaojian: {
							bianma: "notice"
						},
						shuju: {
							detail: this.notice
						}
					}
				}).then(res => {
					this.get_notice()
				})
			},
			get_notice() {
				uni.showLoading({
					mask: true,
					title: "加载中……"
				})
				uniCloud.callFunction({
					name: "delpic",
					data: {
						leixing: 17,
						shuju: {
							bianma: "notice"
						}
					}
				}).then(res => {
					uni.hideLoading()
					if (res.result.data.length) {
						this.notice = res.result.data[0].detail
					}
				})
			}
		}
	}
</script>